<template>
	<view>
		<view class="content" v-if="searchResult.length != 0">
			<view class="list">
				<view class="list-item" v-for="item in searchResult" :key='item.goods_id' @tap="toDetail(item.goods_id, item.one_class_id)">
					<view class="goods_thumbnail_image left">
						<image :src="item.goods_thumbnail_image" mode="aspectFit"></image>
					</view>
					<view class="right">
							<view class="goods_extend_name">
								{{item.goods_extend_name}}
							</view>
							<view class="goods_item">
								{{item.goods_item}}
							</view>
							<text class="uni-product-price-original" >店铺价：￥{{item.goods_shop_price}}</text>
						
					</view>
					</view>
				
			</view>
		</view>
		<view v-else>
			<text>不好意思，没找到关于<text style="color: red;">{{keywords}}</text>的搜索结果</text>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				searchResult: this.$store.state.searchResult, //搜索结果
				keywords: '' //关键字 
			}
		},
		methods:{
			toDetail(goods_id, class_id) {
				uni.navigateTo({
					url: '../../goodsDetail?goods_id=' + goods_id + '&class_id=' + class_id
				});
			},
			
		},
		onLoad(val) {
			this.keywords = val.keywords
		},
		onShow(){
			
		}
	}
</script>

<style>
	.list{
		padding: 30upx 20upx 0;
	}
	.list .list-item{
		height: 250upx;
		background: #c9c9c9;
		display: flex;
		flex-direction: row;
		margin-bottom: 40upx;
	}
	.list .list-item .left image{
		padding: 25upx;
		width: 200upx;
		height: 200upx;
	}
	.list .list-item .right{
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
</style>